home *** CD-ROM | disk | FTP | other *** search
- /* was from Dale Schumacher's dLibs library */
- /* totally different now */
-
- #include <stdio.h>
- #include <limits.h>
- #include <memory.h>
-
- int setvbuf(fp, bp, bmode, size)
- register FILE *fp;
- char *bp;
- int bmode;
- size_t size;
- {
- if(fp->_flag & _IOMYBUF)
- free(fp->_base);
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF | _IOMYBUF);
- fp->_flag |= bmode;
- fp->_cnt = 0;
- if((bmode == _IONBF) || (bp == NULL)) /* unbuffered */
- {
- fp->_base = &(fp->_ch); /* use tiny buffer */
- fp->_bsiz = 1;
- }
- else /* full buffering */
- {
- fp->_base = (unsigned char *)bp;
- fp->_bsiz = size;
- }
- fp->_ptr = fp->_base;
- return 0;
- }
-